package com.zhangzeqin.code.service.Impl;

import com.zhangzeqin.code.dao.GetWordDao;
import com.zhangzeqin.code.dao.Impl.WordBookDaoImpl;
import com.zhangzeqin.code.dao.WordBookDao;
import com.zhangzeqin.code.service.WordBookService;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public class WordBookServiceImpl implements WordBookService {
    /**
     * 实例化一个持久层对象
     */
    WordBookDao wordBookDao=new WordBookDaoImpl();
    GetWordDao getWordDao=  new WordBookDaoImpl();
    /**
     * 添加单词书
     * @param bookName
     * @return boolean结果
     */
    @Override
    public boolean addBook(String bookName,String nature) {
        return wordBookDao.addBook(bookName,nature);
    }

    @Override
    public boolean deleteBook(String bookName) throws SQLException {
        return wordBookDao.deleteBook(bookName);
    }

    @Override
    public boolean checkWord(String wordBook, String word, String meaning) {
        return wordBookDao.checkWord(wordBook,word,meaning);
    }


    @Override
    public List<Map> getWord(String table) throws SQLException{
        return getWordDao.getWord(table);
        }
}

